home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _GETATTR.C < prev    next >
Text File  |  1992-11-21  |  1KB  |  53 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__getattr = "$Header: c:/curses/private/RCS/_getattr.c%v 2.0 1992/11/15 03:24:23 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_get_attribute()  - Get attribute at current cursor
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses function
  17.  
  18.        Return the current attr at current cursor position on the screen.
  19.  
  20.   PDCurses Return Value:
  21.        This routine will return OK upon success and otherwise ERR will be
  22.        returned.
  23.  
  24.   PDCurses Errors:
  25.        There are no defined errors for this routine.
  26.  
  27.   Portability:
  28.        PDCurses        int     PDC_get_attribute( void );
  29.  
  30. **man-end**********************************************************************/
  31.  
  32. int    PDC_get_attribute(void)
  33. {
  34. #ifdef FLEXOS
  35.        /* Get and return current attribute.  Force error until fixed. */
  36.        return ((COLOR_CYAN) >> ((sizeof(ch type) / 2) * 8));
  37. #endif
  38. #ifdef DOS
  39.        regs.x.ax = 0x0800;
  40.        regs.h.bh = _cursvar.video_page;
  41.        int86(0x10, ®s, ®s);
  42.        return ((int) regs.h.ah);
  43. #endif
  44. #ifdef OS2
  45.        char Cell[4];
  46.        USHORT cellLen = 2;
  47.        USHORT curRow = PDC_get_cur_row();
  48.        USHORT curCol = PDC_get_cur_col();
  49.        VioReadCellStr((PCH)&Cell, (PUSHORT)&cellLen, (USHORT)curRow, (USHORT)curCol, 0);
  50.        return ((int) Cell[1]);
  51. #endif
  52. }
  53.